package com.iwaster.service.impl;

import com.iwaster.dao.StudentDao;
import com.iwaster.dao.impl.StudentDaoImpl;
import com.iwaster.domain.PageBean;
import com.iwaster.domain.Student;
import com.iwaster.service.StudentService;

import java.util.List;

/**
 * wgy 2019/4/23 14:33
 */
public class StudentServiceImpl implements StudentService {
    @Override
    public PageBean<Student> getDataByPage(int pageIndex, int pageSize) {
        //1获取数据
        StudentDao studentDao=new StudentDaoImpl();
        List<Student> data=studentDao.findByPage(pageIndex, pageSize);
        //2获取数据个数
        long totalSize = studentDao.getCount();
        PageBean<Student> pageBean=new PageBean<>(pageIndex, pageSize, totalSize, data);
        return pageBean;
    }
}
